﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ObjectDataSourceDemo.aspx.cs" Inherits="ObjectDataSourceDemo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnablePaging="True" 
    SelectMethod="Select" 
    TypeName="ProductCategoryDataObject" 

    UpdateMethod="Update"             
    SelectCountMethod="SelectCount" 
    DeleteMethod="Delete" 

    OldValuesParameterFormatString="original_{0}" 
    SortParameterName="sort"
        >
    <DeleteParameters>
        <asp:Parameter Name="categoryId" Type="Int32" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="original_ProductCategoryID" Type="Int32" />
        <asp:Parameter Name="name" Type="String" />
    </UpdateParameters>
</asp:ObjectDataSource>
    </div>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataSourceID="ObjectDataSource1" AllowPaging="True" AllowSorting="True" 
        DataKeyNames="ProductCategoryID" PageSize="2">
        <Columns>
            <asp:CommandField ShowEditButton="True" />
            <asp:BoundField DataField="ProductCategoryID" HeaderText="ProductCategoryID" 
                SortExpression="ProductCategoryID" ReadOnly="True" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="ModifiedDate" HeaderText="ModifiedDate" 
                SortExpression="ModifiedDate" ReadOnly="True" />
        </Columns>
    </asp:GridView>
    </form>
</body>
</html>
